package com.bingxue.edu.framework.exception;

import lombok.Getter;

/**
 * 公共错误码
 *
 * @author panbo
 * @since 2024/6/26
 */
public enum CommonErrorCode implements ErrorCode {
    // 系统错误
    SYSTEM_ERROR(100000, "系统错误，{}"),
    NULL_VALUE(100001,"空值异常"),

    // 业务错误
    REQUEST_FAILED(200000, "请求失败, {}"),
    REQUEST_UNAUTHENTICATED(200401, "登录信息已失效，请重新登录"),
    REQUEST_UNAUTHORIZED(200403, "权限不足"),
    RESOURCE_NOT_FOUND(200404, "请求资源不存在"),

    PARAM_INVALID(200001, "参数验证失败, {}"),

    UPDATE_NOT_EXIST(201000,"更改失败,不存在该数据"),
    ORG_DISABLED(201001,"该部门或校区已禁用"),
    NOT_REMOVABLE(201002,"存在下属部门,不可删除"),
    ;

    private final Integer code;
    private final String message;

    CommonErrorCode(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }
}
